package com.easylinkin.linkappapi.circuit.dto;

/**
 * 断路器报警类型枚举
 */
public enum GiveCodeTypeEnum {
    /**
     * 过压
     */
    OVERVOLTAGE("HV","过压"),
    /**
     *欠压
     */
    UNDERVOLTAGE("LV","欠压"),
    /**
     *过流
     */
    OVERCURRENT("HC","过流"),
    /**
     * 过温
     */
    OVER_TEMPERATURE("HT","过温"),
    /**
     * 漏电
     */
    LEAKAGE_OF_ELECTRICITY("LEAK","漏电"),
    /**
     *电弧告警
     */
    ARC_ALARM("HIGH_ARC","电弧告警"),
    /**
     * 设备离线
     */
    DEVICE_OFFLINE("OFFLINE","设备离线"),
    /**
     * 漏电自检
     */
    LEAKAGE_SELF_CHECK("TEST","漏电自检"),
    /**
     * 漏电测试
     */
    LEAKAGE_TEST("Key_TEST","漏电测试"),
    /**
     * 电弧报警实验
     */
    TELEPHONE_ALARM_EXPERIMENT("Test_ARC","电弧报警实验");

    /**
     * 报警代码
     */
    String code;
    /**
     * 报警名称
     */
    String name;

    GiveCodeTypeEnum( String code,String name) {
        this.name = name;
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public static GiveCodeTypeEnum getEnumByCode(String code){
        GiveCodeTypeEnum[] values = GiveCodeTypeEnum.values();
        for (GiveCodeTypeEnum e:values){
            if (e.getCode().equals(code)){
                return e;
            }
        }
        return null;
    }
}
